package User;

import operation.chef.Ioperation;
import operation.cust.*;
import zy.Cust;
import zy.Warehouse;

import java.util.ArrayList;
import java.util.Scanner;

/*
 *@Student 张策
 */
public class Customer{
    public static ArrayList<Customer>customers;
    protected Ioperation2[]ioperations2;
    public   void doOperation(int choice, Warehouse warehouse, Cust cust){
        this.ioperations2[choice].work(warehouse,cust);
    }
    public Customer(){
        this.ioperations2=new Ioperation2[]{
                null,
                new cust1(),
                new cust2(),
                new cust3(),
                new cust4(),
                new cust5(),
        };
    }
    public int menu() {
        System.out.println("-----顾客板块-------");
        System.out.println("1:查看菜单");
        System.out.println("2:点菜");
        System.out.println("3:充钱");
        System.out.println("4:注册VIP用户");
        System.out.println("5:查看个人信息");
        System.out.println("6:返回上一级");
        Scanner scanner=new Scanner(System.in);
        int choice;

        while (true) {//判断输入是否合理
            String input = scanner.nextLine();
            try {
                choice = Integer.parseInt(input);

                if (choice >= 1 && choice <= 6) {
                    break;
                } else {
                    System.out.println("输入的数字不在1~6之间，请重新输入！");
                }
            } catch (NumberFormatException e) {
                System.out.println("输入的不是数字，请重新输入！");
            }
        }
        return choice;
    }
}
